package com.dou.sample.opengl_project;

import java.util.Vector;

import javax.microedition.khronos.opengles.GL10;

/**
 * Created by Dou on 2018/1/15.
 */

public class Group extends Mesh {

    private Vector<Mesh> children = new Vector<>();

    @Override
    public void draw(GL10 gl) {
        int size = children.size();

        for (int i = 0; i < size; i++){
            children.get(i).draw(gl);
        }
    }

    public void add(int location, Mesh object){
        children.add(location, object);
    }

    public boolean add(Mesh object){
        return children.add(object);
    }

    public void clear(){
        children.clear();
    }

    public Mesh get(int location){
        return children.get(location);
    }

    public void remove(int location){
        children.remove(location);
    }

    public boolean remove(Mesh object){
        return children.remove(object);
    }

    public int size(){
        return children.size();
    }
}
